package com.sunseagear.wind.common.interceptor;

import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import com.sunseagear.wind.common.helper.SysConfigHelper;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.MappedStatement;

import java.sql.SQLException;

public class DemoInterceptor implements InnerInterceptor {
    @Override
    public boolean willDoUpdate(Executor executor, MappedStatement ms, Object parameter) throws SQLException {
        boolean isDemo = Boolean.parseBoolean(SysConfigHelper.getInstance().getDefaultConfig("isDemo").getValue());
        return !isDemo;
    }
}
